<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Retrieve records with multiple queries</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tokyotyrantquery.key.html">TokyoTyrantQuery::key</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tokyotyrantquery.next.html">TokyoTyrantQuery::next</a></div>
 <div class="up"><a href="class.tokyotyrantquery.html">TokyoTyrantQuery</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="tokyotyrantquery.metasearch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">TokyoTyrantQuery::metaSearch</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">TokyoTyrantQuery::metaSearch</span> &mdash; <span class="dc-title">Retrieve records with multiple queries</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-tokyotyrantquery.metasearch-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>TokyoTyrantQuery::metaSearch</strong></span>
    ( <span class="methodparam"><span class="type">array</span> <code class="parameter">$queries</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$type</code></span>
   )</div>

  <p class="para rdfs-comment">
   Executes multiple queries on a database and returns matching records. The current object
   is always the left most object in the search.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-tokyotyrantquery.metasearch-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">queries</code></em></dt>

     <dd>

      <p class="para">
       Array of TokyoTyrantQuery objects
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">type</code></em></dt>

     <dd>

      <p class="para">
       One of the <strong><code>TokyoTyrant::RDBMS_*</code></strong> constants
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-tokyotyrantquery.metasearch-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the matching rows and throws TokyoTyrantException on error
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-tokyotyrantquery.metasearch-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2170">
    <p><strong>Example #1 <span class="methodname"><strong>TokyoTyrantQuery::metaSearch()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;Connect&nbsp;to&nbsp;a&nbsp;table&nbsp;database&nbsp;*/<br /></span><span style="color: #0000BB">$tt&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">TokyoTyrantTable</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1979</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Add&nbsp;test&nbsp;data&nbsp;*/<br /></span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'cherry'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'color'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'red'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'strawberry'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'color'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'red'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'apple'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'color'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'green'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'lemon'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #DD0000">'color'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yellow'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">/*&nbsp;First&nbsp;query&nbsp;*/<br /></span><span style="color: #0000BB">$query&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getQuery</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$query</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addCond</span><span style="color: #007700">(</span><span style="color: #DD0000">'color'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">TokyoTyrant</span><span style="color: #007700">::</span><span style="color: #0000BB">RDBQC_STREQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'red'</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">setOrder</span><span style="color: #007700">(</span><span style="color: #DD0000">'color'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">TokyoTyrant</span><span style="color: #007700">::</span><span style="color: #0000BB">RDBQO_STRASC</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Second&nbsp;query&nbsp;*/<br /></span><span style="color: #0000BB">$query1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$tt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getQuery</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$query1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addCond</span><span style="color: #007700">(</span><span style="color: #DD0000">'color'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">TokyoTyrant</span><span style="color: #007700">::</span><span style="color: #0000BB">RDBQC_STREQ</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'yellow'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;Get&nbsp;union&nbsp;between&nbsp;the&nbsp;queries&nbsp;*/<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$query</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">metaSearch</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$query1</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">TokyoTyrant</span><span style="color: #007700">::</span><span style="color: #0000BB">RDBMS_UNION</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [&quot;cherry&quot;]=&gt;
  array(1) {
    [&quot;color&quot;]=&gt;
    string(3) &quot;red&quot;
  }
  [&quot;strawberry&quot;]=&gt;
  array(1) {
    [&quot;color&quot;]=&gt;
    string(3) &quot;red&quot;
  }
  [&quot;lemon&quot;]=&gt;
  array(1) {
    [&quot;color&quot;]=&gt;
    string(6) &quot;yellow&quot;
  }
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-tokyotyrantquery.metasearch-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="tokyotyrantquery.search.html" class="methodname" rel="rdfs-seeAlso">TokyoTyrantQuery::search()</a> - Searches records</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tokyotyrantquery.key.html">TokyoTyrantQuery::key</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tokyotyrantquery.next.html">TokyoTyrantQuery::next</a></div>
 <div class="up"><a href="class.tokyotyrantquery.html">TokyoTyrantQuery</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
